<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<base href="<%=basePath%>">

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link rel="stylesheet" href="forum/css/style.css" type="text/css" />
		<link rel="stylesheet" href="forum/css/admin.css" type="text/css" />
		<link rel="stylesheet" href="forum/css/userHome.css" type="text/css" />

		<title>用户空间</title>
		<script type="text/javascript" src="forum/js/mycheck.js"></script>
		<script type="text/javascript" src="forum/js/user.js"></script>
		<script type="text/javascript">
			function mytest() {
				var qq = document.info.qq.value;
				alert(qq);
			}
		</script>
	</head>
	<body>
	<input type="hidden" id="uname" value="<s:property value='#session.userInfo.name'/>"/>
		<script type="text/javascript">	
			
			var uname=document.getElementById("uname").value;
			if(uname=='')
			{
				alert("请先登录");
				uri="login.jsp";
				window.location.href=uri;
			}
		
		</script>
		<jsp:include page="../include/header.jsp"></jsp:include>

		<table class="loginTable" border="0" align="center">
			<!--主题内容区-->

			<jsp:include page="../include/welcomeBanner.jsp"></jsp:include>
			<tr>
				<td>
					<hr size="4" color="#B5BAC7" style="margin-top: 0px;">
				</td>
			</tr>
			<tr>
				<td class="currentPos" colspan="3">
					<div style="float: left; width: 400px">
						<img src="forum/img/current.png" />
						当前位置：
						<span class="pos"><s:a action="init" namespace="/">首页</s:a>->
							<a href="javascript:void()">个人资料</a></span>
					</div>
				</td>
			</tr>
			<tr>
				<td>
					<div style="float: left;">
						<ul class="glossymenu">
							<li id="info1" onmousedown="setTab('info',1)" class="Menubox_on">
								<a>个人信息</a>
							</li>
							<li id="info2" onmousedown="setTab('info',2)">
								<a>头像管理</a>
							</li>
							<li id="info3" onmousedown="setTab('info',3)">
								<a>密码管理</a>
							</li>
						</ul>
					</div>
					<div id="contt">
						<div id="info_1" class="info">
							<h3>
								<label>
									基本信息:
								</label>
							</h3>
							<s:form name="info" action="user" namespace="/">
								<s:hidden name="id" value="%{#session.userInfo.id}" />
								<tr>
									<td>姓名</td>
									<td>
										<input type="text" name="name" value="<s:property value="#session.userInfo.name"/>" disabled />
									</td>
								</tr>
								<tr>
									<td>性别  </td>
									<td>
										<s:if test="#session.userInfo.sex == 'Male'">
											<input type="Radio" name="sex" value="Female">女
												<input type="Radio" name="sex" value="Male" checked>男<br>
										</s:if>
										<s:else>
											<input type="Radio" name="sex" value="Female" checked>女
												<input type="Radio" name="sex" value="Male">男<br>
										</s:else>
									</td>
								</tr>
								<tr>
									<td>民族</td>
									<td>
										<input type="text" name="nation" value="<s:property value="#session.userInfo.nation"/>" />
									</td>
								</tr>
								<tr>
									<td>QQ&nbsp;</td>
									<td>
										<input type="text" name="qq" value="<s:property value="#session.userInfo.qq"/>" />
									</td>
								</tr>
								<tr>
									<td>专业</td>
									<td>
										<input type="text" name="major" value="<s:property value="#session.userInfo.major"/>" />
									</td>
								</tr>
								<tr>
									<td>邮箱</td>
									<td>
										<input type="text" name="email" value="<s:property value="#session.userInfo.email"/>" disabled />
									</td>
								</tr>
								<s:submit value="保存" method="updateInfo"></s:submit>
							</s:form>

						</div>
						<div id="info_2" style="display: none" class="info">
							<h3>
								头像:
							</h3>
							<s:form action="user" method="POST" enctype="multipart/form-data"
								namespace="/">
								<s:hidden name="id" value="%{#session.userInfo.id}" />
								<img src="<s:property value="#session.userInfo.picture"/>"
									border="0" height="80" width="80" />
								选择:
								<input type="file" name="upload" />
								<s:submit value="确定" method="saveImage" />
							</s:form>
						</div>
						<div id="info_3" style="display: none" class="info">
							<h3>
								<label>
									修改密码:
								</label>
							</h3>
							<s:form action="user" namespace="/">
								<s:hidden name="id" value="%{#session.userInfo.id}" />
								<s:hidden name="name" id="name"
									value="%{#session.userInfo.name}" />

								<table border="0" align="left">
									<tr>
										<td>
											原始密码:
										</td>
										<td colspan="2">
											<table border="0">
												<s:password name="opwd" id="opwd" maxlength="16"
													style="width: 150px" onblur="">
												</s:password>
											</table>
										</td>
										<td width="100px">
											<span id="pwd_e"><s:property value="#pwd_e" /> </span>
										</td>
									</tr>

									<tr>
										<td>
											新&nbsp;&nbsp;密&nbsp;&nbsp;码:
										</td>
										<td colspan="2">
											<table>
												<s:password name="pwd" id="pwd" maxlength="16"
													style="width: 150px">
												</s:password>
											</table>
										</td>
										<td>
											<span id="pwd_i"></span>
										</td>
									</tr>

									<tr>
										<td>
											确认密码:
										</td>
										<td colspan="2">
											<table>
												<s:password name="rpwd" id="rpwd" maxlength="16"
													style="width: 150px" onchange="checkPwd_()">
												</s:password>
											</table>
										</td>
										<td>
											<span id="rpwd_i"></span>
										</td>
									</tr>
									<tr>
										<s:submit id="button" name="button" value="修改"
											method="changePwd" disabled="true" />
									</tr>
								</table>
							</s:form>
						</div>

					</div>
				</td>
			</tr>
		</table>
		<jsp:include page="../include/footer.jsp"></jsp:include>
	</body>
</html>

